const app = getApp();
Page({
  data: {
    phonehe: '',
    phoneshe: '',
    longitude: 0,
    latitude: 0,
    tiaozhuanNum: 0,
  },
  callhe: function () {
    wx.makePhoneCall({
      phoneNumber: app.globalData.bridegroomTel, // 你要拨打的电话号码
      success: function () {
        console.log('拨打电话成功');
      },
      fail: function () {
        console.log('拨打电话失败');
      }
    });
  },
  callshe: function () {
    wx.makePhoneCall({
      phoneNumber: app.globalData.brideTel,
      success: function () {
        console.log('拨打电话成功');
      },
      fail: function () {
        console.log('拨打电话失败');
      }
    });

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  markertap(e) {
    console.log(app.globalData.longitude,app.globalData.mapName,'1');
    wx.openLocation({
      longitude: parseFloat(app.globalData.longitude),
      latitude: parseFloat(app.globalData.latitude),
      scale: 15,
      name: app.globalData.mapName,
      address: app.globalData.address
    })
  },


  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.setData({
      longitude: app.globalData.longitude,
      latitude: app.globalData.latitude,
    })

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setData({
      tiaozhuanNum: 0
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    });
    return {
      title: '诚意邀请你参加我们的婚礼',
      imageUrl: app.globalData.imageUrlFinally,
      path: "pages/pics/pics?type=" + app.globalData.type,
      success: function (res) {
        wx.showToast({
          title: '分享成功',
        })
      },
      fail: function (res) {
        // 转发失败
        wx.showToast({
          title: '分享取消',
        })
      }
    }
  },
  //用户点击右上角分享朋友圈
  onShareTimeline: function () {
    return {
      title: '诚意邀请你参加我们的婚礼',
      imageUrl: app.globalData.imageUrlFinally,
      path: "pages/pics/pics?type=" + app.globalData.type,
      // query: 'type=' + app.globalData.type
    }
  },


  tiaozhuan() {
    this.setData({
      tiaozhuanNum: this.data.tiaozhuanNum + 1
    })
    if (this.data.tiaozhuanNum > 10) {
      wx.navigateTo({
        url: '/pages/hidePage/hidePage',
        success: function (res) {}
      })
    }

  }
})